﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;


namespace AutoDeploy.Common.Library
{
    /// <summary>
    /// Element grouping 
    /// Mark Rowe markwrowe@hotmail.com  http://everythingworkflow.spaces.live.com  ,  Daniel Turnell daniel.turnell@gmail.com
    /// This Project http://autodeploy.codeplex.com
    /// </summary>
    public class ElementSet
    {
        /// <summary>
        /// Does this element have a namespace
        /// </summary>
        public bool hasNameSpace { get; set; }
        /// <summary>
        /// What is the valid namespace for this element.
        /// </summary>
        public string NameSpace { get; set; }
        /// <summary>
        /// What is the XNamespace for this element
        /// </summary>
        public XNamespace xNameSpace { get; set; }
        /// <summary>
        /// The Current Element "name"
        /// </summary>
        public string CurrentElement { get; set; }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="xPath">The xpath expression</param>
        public ElementSet(string xPath)
        {
            NameSpace = xPath.GetXNameSpaceNameLocal();
            hasNameSpace = (NameSpace.Length > 0 ? true : false);
            xNameSpace = (hasNameSpace ? NameSpace : string.Empty);
            CurrentElement = xPath.GetElementNameLocal();
        }
    }
}

